﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JLSQLBrowser
{
    class Sql
    {
        #region Public Properties

        public SqlAuthentication AuthenticationMethod { get; set; }
        public string Catalog { get; set; }
        public string Server { get; set; }
        public string User { get; set; }
        public string Password { get; set; }

        private string _connectionString = string.Empty;
        public string ConnectionString
        {
            set
            {
                value = (AuthenticationMethod = SqlAuthentication.Windows)
                    != SqlAuthentication.Windows ? 
                    "Data Source="+ Server + ";Initial Catalog=" + Catalog + ";Integrated Security=SSPI;" :
                    "Data Source=" + Server + ";Initial Catalog=" + Catalog + ";User Id=" + User + ";Password=" + Password + ";";
                _connectionString = value;
            }
        }


        #endregion

        #region Enums

        public enum SqlAuthentication
        {
            Windows = 0,
            SqlServer = 1
        }

        #endregion
    }
}
